home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / test_aepack.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  3KB  |  96 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.4)
  3.  
  4. import unittest
  5. import aepack
  6. import aetypes
  7. import os
  8. from test import test_support
  9.  
  10. class TestAepack(unittest.TestCase):
  11.     OBJECTS = [
  12.         aetypes.Enum('enum'),
  13.         aetypes.Type('type'),
  14.         aetypes.Keyword('kwrd'),
  15.         aetypes.Range(1, 10),
  16.         aetypes.Comparison(1, '<   ', 10),
  17.         aetypes.Logical('not ', 1),
  18.         aetypes.IntlText(0, 0, 'international text'),
  19.         aetypes.IntlWritingCode(0, 0),
  20.         aetypes.QDPoint(50, 100),
  21.         aetypes.QDRectangle(50, 100, 150, 200),
  22.         aetypes.RGBColor(28672, 24576, 20480),
  23.         aetypes.Unknown('xxxx', 'unknown type data'),
  24.         aetypes.Character(1),
  25.         aetypes.Character(2, aetypes.Line(2))]
  26.     
  27.     def test_roundtrip_string(self):
  28.         o = 'a string'
  29.         packed = aepack.pack(o)
  30.         unpacked = aepack.unpack(packed)
  31.         self.assertEqual(o, unpacked)
  32.  
  33.     
  34.     def test_roundtrip_int(self):
  35.         o = 12
  36.         packed = aepack.pack(o)
  37.         unpacked = aepack.unpack(packed)
  38.         self.assertEqual(o, unpacked)
  39.  
  40.     
  41.     def test_roundtrip_float(self):
  42.         o = 12.1
  43.         packed = aepack.pack(o)
  44.         unpacked = aepack.unpack(packed)
  45.         self.assertEqual(o, unpacked)
  46.  
  47.     
  48.     def test_roundtrip_None(self):
  49.         o = None
  50.         packed = aepack.pack(o)
  51.         unpacked = aepack.unpack(packed)
  52.         self.assertEqual(o, unpacked)
  53.  
  54.     
  55.     def test_roundtrip_aeobjects(self):
  56.         for o in self.OBJECTS:
  57.             packed = aepack.pack(o)
  58.             unpacked = aepack.unpack(packed)
  59.             self.assertEqual(repr(o), repr(unpacked))
  60.         
  61.  
  62.     
  63.     def test_roundtrip_FSSpec(self):
  64.         
  65.         try:
  66.             import Carbon.File as Carbon
  67.         except:
  68.             return None
  69.  
  70.         o = Carbon.File.FSSpec(os.curdir)
  71.         packed = aepack.pack(o)
  72.         unpacked = aepack.unpack(packed)
  73.         self.assertEqual(o.as_pathname(), unpacked.as_pathname())
  74.  
  75.     
  76.     def test_roundtrip_Alias(self):
  77.         
  78.         try:
  79.             import Carbon.File as Carbon
  80.         except:
  81.             return None
  82.  
  83.         o = Carbon.File.FSSpec(os.curdir).NewAliasMinimal()
  84.         packed = aepack.pack(o)
  85.         unpacked = aepack.unpack(packed)
  86.         self.assertEqual(o.FSResolveAlias(None)[0].as_pathname(), unpacked.FSResolveAlias(None)[0].as_pathname())
  87.  
  88.  
  89.  
  90. def test_main():
  91.     test_support.run_unittest(TestAepack)
  92.  
  93. if __name__ == '__main__':
  94.     test_main()
  95.  
  96.